/**==============================================================================
            Copyright (c) 2013 Moritz Hader, Marcel Schrder
            All Rights Reserved.

	@file  HeimdallMesh.java

	@brief  This object represents the counterpart to the nativeMesh. It defines
	enumerations that are used to identify the stock-meshes that can be loaded
	in the nateive-code.

  This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
==============================================================================*/

package de.ibm.dhbw.heimdall.engine;

import java.util.logging.Logger;


import de.ibm.dhbw.heimdall.HeimdallAR;



public class HeimdallMesh {

	private static Logger Log = Logger.getLogger(HeimdallMesh.class.getCanonicalName());
	
	private int meshType;
	
	//native int makeVertexCounterpart(int count, int id);
	//native int makeVertexCounterpartAlt(int count,float[] vert,float[]norm ,int id);
	
	//native int makeStockCounterpart(int stock, int id);
	
	//Enum for stock meshes
	public enum STOCK_MESHES{
		DEFAULT_CUBE,
		DEFAULT_GRID,
		DEFAULT_CONE,
		DEFAULT_BARRIER,
		DEFAULT_TRAFFICL,
		DEFAULT_FANCYCAR,
		NONE
	};
	
	//Enum for Shaders
	public enum STOCK_SHADERS{
		UNIFORM_COLOR,
		PRIMITIVE_SHADING,
		POINT_LIGHT,
		TEXTURE
	}
	
	//Enum for Shapes
	public enum STOCK_SHAPES{
		GL_LINEAR,
		GL_TRIANGLE
	}
	
	//Load the native library into the code
	static{
		HeimdallAR.LoadNativeLib("HeimdallARNative");
	}
		
	public HeimdallMesh(){
		this.meshType = STOCK_MESHES.NONE.ordinal();
	}
	
	/*public void Load(float[] vertex){
		
		if (this.vertexData == null){
			this.vertexData = new float[vertex.length];
		}
		
		this.vertexData = vertex;
		
		this.identifier = makeVertexCounterpart(this.vertexData.length, -1);
	}
	
	public void Load(float[] vertex, float[] normal){
		
		if (this.vertexData == null){
			this.vertexData = new float[vertex.length];
		}
		
		this.vertexData = vertex;
		
		if (this.normalData == null){
			this.normalData = new float[normal.length];
		}
		
		this.normalData = normal;
			this.isNormalSet = true;
			
		if(this.normalData.length == this.vertexData.length){
			//this.identifier = makeVertexCounterpart(this.vertexData.length, -1);
			this.identifier = makeVertexCounterpartAlt(this.vertexData.length, this.vertexData, this.normalData,-1);
		}else{
			Log.e("ERROR", "Error. The length of the normal array did not match the length of the vertex array");
		}
	}*/
	
	public void load(STOCK_MESHES stockName){

		this.meshType = stockName.ordinal();
		//makeStockCounterpart(stockName.ordinal(),-1);
	}
	
	public int getMesh() {
		return meshType;
	}
	
	public int getMeshInteger(){
		return meshType;
	}


}
